package org.jground.rx.def.apps.accounting;
import org.jground.rx.*;
import org.jground.rx.gen.*;
import org.jground.util.*;
import java.util.List;
import org.jground.rx.def.apps.commons.*;
import org.jground.rx.def.apps.knowledge.*;
import org.jground.rx.def.*;
import org.jground.rx.def.apps.crm.*;
import org.jground.rx.def.apps.cip.*;
import org.jground.rx.def.apps.core.*;
import org.jground.rx.def.apps.legal.*;
import org.jground.rx.def.apps.ipm.*;
@SuppressWarnings("unused")
public class CostCenter extends GenRoot {

    public static final String moid = "org.jground.rx.def.apps.accounting.CostCenter";

    private static final String name ="name";
    private static final String description ="description";
    private static final String workforce ="workforce";
    private static final String sponsor ="sponsor";
    private static final String activityTypes ="activityTypes";
    private static final String billingInformation ="billingInformation";
    private static final String workTimeItems ="workTimeItems";
    private static final String $CREATOR ="$CREATOR";

    public static final class AttName {
        public static final String name ="name";
        public static final String description ="description";
        public static final String workforce ="workforce";
        public static final String sponsor ="sponsor";
        public static final String activityTypes ="activityTypes";
        public static final String billingInformation ="billingInformation";
        public static final String workTimeItems ="workTimeItems";
        public static final String $CREATOR ="$CREATOR";
    }

    public static CostCenter createNew() { return new CostCenter(RXObjectService.getInstance().create(moid)); }

    public static CostCenter getById(String oid) { 
        IRXObject mod = RXObjectService.getInstance().getById(oid);
        if(mod == null) { return null; }
        return new CostCenter(mod);
    }

    public static CostCenter[] getByIds(String... oids) { 
        List<IRXObject> mods = RXObjectService.getInstance().getByIds(moid, oids);
        CostCenter[] res = new CostCenter[mods.size()];
        int i = 0;
        for(IRXObject mod : mods) {
            res[i] = new CostCenter(mod);
            i++;
        }
        return res;
    }

    public static SearchCriteria newSearchCriteria() {
        return  SearchCriteria.create(moid);
    }

    public static CostCenter[] search(SearchCriteria sc) {
        return  wrap(GenRoot._search(sc));
    }

    public static CostCenter[] wrap(List<? extends IRXObjectSynopsis> mods) { 
        CostCenter[] res = new CostCenter[mods.size()];
        int i = 0;
        for(IRXObjectSynopsis mod : mods) {
            res[i] = new CostCenter(mod);
            i++;
        }
        return res;
    }

    public static CostCenter wrap(IRXObjectSynopsis mod) { 
        return new CostCenter(mod);
    }

    private CostCenter(IRXObjectSynopsis rxObject) {this.rxObject = (IRXObject) rxObject;}

    public static String getNameLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, name).getLabel();
    }

    public static String getNameDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, name).getDescription();
    }

    public void setName(String string) {
        rxObject.set(name, _to_String(string));
    }

    public String getName() {
        return _to_String(rxObject.getCurrentValue(name));
    }

    public static String getDescriptionLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, description).getLabel();
    }

    public static String getDescriptionDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, description).getDescription();
    }

    public void setDescription(String text) {
        rxObject.set(description, _to_String(text));
    }

    public String getDescription() {
        return _to_String(rxObject.getCurrentValue(description));
    }

    public static String getWorkforceLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, workforce).getLabel();
    }

    public static String getWorkforceDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, workforce).getDescription();
    }

    public int getWorkforceSize() {
        return org.jground.rx.def.apps.accounting.Workforce.wrap(rxObject.getComponents(AttName.workforce)).length;
    }

    public org.jground.rx.def.apps.accounting.Workforce[] getWorkforce() {
        return org.jground.rx.def.apps.accounting.Workforce.wrap(rxObject.getComponents(AttName.workforce));
    }

    public org.jground.rx.def.apps.accounting.Workforce getWorkforce(int index) {
        return org.jground.rx.def.apps.accounting.Workforce.wrap(rxObject.getComponents(AttName.workforce))[index];
    }

    public org.jground.rx.def.apps.accounting.Workforce createWorkforce() {
        return org.jground.rx.def.apps.accounting.Workforce.wrap(rxObject.newComponent(workforce));
    }

    public void setWorkforce(org.jground.rx.def.apps.accounting.Workforce[] values) {
        rxObject.set(workforce, _to_String(workforce));
    }

    public void addWorkforce(org.jground.rx.def.apps.accounting.Workforce value) {
        rxObject.add(workforce, value.getOidString());
    }

    public static String getSponsorLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, sponsor).getLabel();
    }

    public static String getSponsorDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, sponsor).getDescription();
    }

    public void setSponsor(org.jground.rx.def.apps.core.Institution value) {
        rxObject.set(sponsor, _to_String(value));
    }

    public org.jground.rx.def.apps.core.Institution getSponsor() {
        return org.jground.rx.def.apps.core.Institution.getById(rxObject.getCurrentValue(sponsor));
    }

    public static String getActivityTypesLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, activityTypes).getLabel();
    }

    public static String getActivityTypesDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, activityTypes).getDescription();
    }

    public void addActivityTypes(org.jground.rx.def.apps.accounting.ActivityType... value) {
        rxObject.set(activityTypes, _to_String(value));
    }

    public void setActivityTypes(org.jground.rx.def.apps.accounting.ActivityType[] values) {
        rxObject.set(activityTypes, _to_String(values));
    }

    public int getActivityTypesSize() {
        return StringUtils.rnn(rxObject.getValues(activityTypes)).length;
    }

    public org.jground.rx.def.apps.accounting.ActivityType[] getActivityTypes() {
        return org.jground.rx.def.apps.accounting.ActivityType.getByIds(rxObject.getValues(activityTypes));
    }

    public org.jground.rx.def.apps.accounting.ActivityType getActivityTypes(int index) {
        return org.jground.rx.def.apps.accounting.ActivityType.getByIds(rxObject.getValues(activityTypes))[index];
    }

    public static String getBillingInformationLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, billingInformation).getLabel();
    }

    public static String getBillingInformationDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, billingInformation).getDescription();
    }

    public org.jground.rx.def.apps.accounting.BillingInformation getBillingInformation() {
        return ArrayUtils.first(org.jground.rx.def.apps.accounting.BillingInformation.wrap(rxObject.getComponents(AttName.billingInformation)));
    }

    public org.jground.rx.def.apps.accounting.BillingInformation createBillingInformation() {
        return org.jground.rx.def.apps.accounting.BillingInformation.wrap(rxObject.newComponent(billingInformation));
    }

    public void setBillingInformation(org.jground.rx.def.apps.accounting.BillingInformation value) {
        rxObject.set(billingInformation, value.getOidString());
    }

    public static String getWorkTimeItemsLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, workTimeItems).getLabel();
    }

    public static String getWorkTimeItemsDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, workTimeItems).getDescription();
    }

    public static String get$CREATORLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, $CREATOR).getLabel();
    }

    public static String get$CREATORDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, $CREATOR).getDescription();
    }

    public void set$CREATOR(String string) {
        rxObject.set($CREATOR, _to_String(string));
    }

    public String get$CREATOR() {
        return _to_String(rxObject.getCurrentValue($CREATOR));
    }

}
